import java.util.ArrayList;

public class ConservativeAgent extends Agent{

	/**
	 * 
	 * Assigns a particular bet value to different ranks of hands, from 0-18 (2 per rank of hand)
	 * 
	 * The agent will bet exactly what their hand is worth to them.
	 * 
	 * Assumes that all agents value hands the same weigh.  If an agent has bet 3 ranks above them, 
	 * they will fold
	 * if roundBet > handValue + 4, then fold
	 * 
	 */
	
	@Override
	public void evaluateProbabilities()
	{

	}
	@Override
	public Action takeTurn()
	{
		printCards();
		
		ArrayList<Card> fullCards = getFullCards();
		Hand best = Hand.getBestHand(fullCards);
		int value = 0;
		if (best != null)
			value = best.getValue();
		int handValue = handValue(value);
		int tableBet = table.getRoundBet();
		if (Math.random() * tableBet > handValue + 4)
			return Action.foldAction();
		else if (tableBet >= handValue)
			return Action.callAction();
		else
		{
			int raiseAmt = table.getMaxBet() + handValue - tableBet;
			return Action.raiseAction(raiseAmt);
		}
			
	}
	
	public int handValue(int v)
	{
		int val = v>>(4 * 5);
		val *= 2;
		if (Simulator.DEBUG)
		System.out.println("Hand value is: "+val);
		return val;
	}

}
